<html>
<head>
	<meta charset="UTF-8">
	<title>外部模型节点链接条件列表</title>
	<link id="easyuiTheme"  href="../../static/easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css"/>
	<link href="../../static/easyui/themes/icon.css" rel="stylesheet" type="text/css"/>
	<link href="../../static/css/esaas-easyui-add.css" rel="stylesheet" type="text/css"/>
	<script src="../../static/easyui/jquery.min.js" type="text/javascript"></script>
	<script src="../../static/easyui/jquery.cookie.js" type="text/javascript"></script>
	<script src="../../static/easyui/ui-theme.js" type="text/javascript"></script>
	<script src="../../static/easyui/jquery.easyui.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../static/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
	<script src="../../static/plugin/assets/jslib.util.js" type="text/javascript"></script>
	<script src="../../static/plugin/assets/jslib.jquery.ajax.js" type="text/javascript"></script>
	<script src="../../static/plugin/assets/jslib.easyui.util.js" type="text/javascript"></script>
	<script src="../../ffres/dict/all.js" type="text/javascript"></script>
	<a href="" target="_blank" id="commonLink" name="commonLink"></a>
</head>
<script type="text/javascript">
	var appId = $.getUrlParam('appId');
	var linkedId = $.getUrlParam('linkedId');
	var dialog = $.getUrlParam('dialog');

	function doAdd(){
		JLEUtil.createModalWin('新增', `OsrvLinkedCondAdd.html?appId=${appId}&linkedId=${linkedId}`);
	}
	
	function doUpdate() {
		var row = $('#dg').datagrid('getSelected');
		if (row){
			JLEUtil.createModalWin('修改', `OsrvLinkedCondUpdate.html?appId=${appId}&linkedId=${linkedId}&` + 'condId=' + row.condId);
		} else {
			$.messager.alert('提示','请选择一条记录！','info');
		}
	}
	
	function doDelete(){
		var row = $('#dg').datagrid('getSelected');
		if (row) {
			$.messager.confirm('删除提示', '你确定要删除这条记录?', function(r){
				if (r){
					var jsonData = JSON.parse('{'+'"condId":"' + row.condId + '"'+'}');
					$.restfulDelete('/esaas-sdcenter-front/api/osrv/linked/cond', jsonData, function(data) {
						$.messager.alert('提示','记录删除成功!','info');
						$('#dg').datagrid('reload');
					});
				}
			});
		} else {
			$.messager.alert('提示','请选择一条记录！','info');
		}
	}

	function doView(){
		var row = $('#dg').datagrid('getSelected');
		if (row) {
			JLEUtil.createModalWin('详情',`OsrvLinkedCondView.html?appId=${appId}` + '&condId=' + row.condId);
		} else {
			$.messager.alert('提示','请选择一条记录！','info');
		}
	}	

	function reloadList(){
		$('#dg').datagrid('reload');
		JLEUtil.closewin();
	};
	$(function(){
		$('#dg').datagrid({
			url : `../../api/osrv/linked/conds`,
			queryParams: {
				linkedId: linkedId
			}
		});
		if (dialog == 'show') {
			$('#closeBtn').show()
		}
		if (readonly) {
			$('.readonly-hidden').hide()
		}
	});

	function closeForm() {
		window.parent.JLEUtil.closewin();
	}
</script>
</head>
<body class="easyui-layout">
<div data-options="region:'north',title:''" style="height: 40px; background: #F4F4F4;">
	<form id="searchForm">
		<table>
			<tr>
				<td>&nbsp;条件字段代码：</td>
				<td><input name="condFieldCode" id="condFieldCode"/></td>
				<td><a class="easyui-linkbutton" href="javascript:void(0);" onclick="JLEUtil.queryForm('searchForm','dg','../../api/osrv/linked/conds/'+appId);">查找</a></td>
				<td><a class="easyui-linkbutton" href="javascript:void(0);" onclick="JLEUtil.clearForm('searchForm');">清空</a></td>
			</tr>
		</table>
	</form>
</div>
<div data-options="region:'center',split:false">
	<table id="dg" class="easyui-datagrid" title="" style="width:100%;height:100%"
			data-options="singleSelect:true,collapsible:true,method:'post'"
			toolbar="#tb"
		title="Load Data" 
		rownumbers="true" pagination="true" pageSize="20">
		<thead>
			<tr>
				<th data-options="field:'condId',resizable:true" hidden="true">条件标识</th>
				<th data-options="field:'linkedId',resizable:true" hidden="true">链接标识</th>
				<th data-options="field:'condFieldCode',resizable:true" >条件字段代码</th>
				<th data-options="field:'condFieldName',resizable:true" >条件字段名称</th>
				<th data-options="field:'condLogicRelation',resizable:true" formatter="formatter_COND_LOGIC_RELATION">条件逻辑关系</th>
				<th data-options="field:'condCompareSign',resizable:true" formatter="formatter_COND_COMPARE_SIGN">比较符</th>
				<th data-options="field:'compareTargetType',resizable:true" formatter="formatter_COMPARE_TARGET_TYPE_OSRV">比较目标类型</th>
				<th data-options="field:'constValue',resizable:true" >常量值</th>
				<th data-options="field:'paramFieldName',resizable:true" >参数名称</th>
				<th data-options="field:'paramFieldCode',resizable:true" >参数代码</th>
			</tr>
		</thead>
	</table>
</div>
<div id="tb" style="padding:1px">
	<div style="margin-bottom:2px">
		<a href="javascript:doAdd()" class="easyui-linkbutton readonly-hidden" iconCls="icon-add" plain="true">新增链接条件</a>
		<a href="javascript:doUpdate()" class="easyui-linkbutton readonly-hidden" iconCls="icon-edit" plain="true">修改链接条件</a>
		<a href="javascript:doDelete()" class="easyui-linkbutton readonly-hidden" iconCls="icon-remove" plain="true">删除链接条件</a>
		<a href="javascript:doView()" class="easyui-linkbutton" iconCls="icon-ok" plain="true">查看链接条件</a>
	</div>
</div>
<div data-options="region:'south',split:false">
	<div style="text-align: center; padding: 15px;height:10%">
		<a href="javascript:void(0)" class="easyui-linkbutton"
		   onclick="closeForm()">&nbsp;关&nbsp;闭&nbsp;</a>
	</div>
</div>
</body>
</html>

